#!/usr/bin/python
# -*- coding: utf-8 -*-

#-------------------------------------------------
#Create At: 2008-11-3 下午10:21:12 
#Create By: Fla.sam
#
#DESC: Core App admin manager
#
#-------------------------------------------------


from CoreApp.models import Place, UserProfile, User_CashTransferHistory
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

admin.site.unregister( User )
  
class UserProfileInline( admin.StackedInline ):
    model = UserProfile
    fk_name = 'user'
    max_num = 1
    fieldsets = ( 
                 ( None, {'fields': ( 'user_chinese_name', 'user_phone', 'user_desc', 'user_bank_name', 'user_bank_acct', 'user_bank_acct_name', 'user_identity_card' )} ), \
                 )


class UserProfileAdmin( UserAdmin ):
    inlines = [UserProfileInline]
    fieldsets = ( 
            ( None, {'fields': ( 'username', 'password', 'email' )} ),
            ( '用户权限', {'fields': ( 'is_staff', 'is_active', 'is_superuser', 'user_permissions' )} ),
            ( '用户所在组', {'fields': ( 'groups', )} ),
        )
  
admin.site.register( User, UserProfileAdmin )

admin.site.register( Place )
admin.site.register( User_CashTransferHistory )